<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
if($_SERVER['HTTP_HOST'] == 'localhost:2014' ||$_SERVER['HTTP_HOST'] == 'batdongsan.local:2014'){
   $info_db = array(
			'connectionString' => 'mysql:host=localhost;dbname=batdongsan',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
		);
}else{
   $info_db = array(
			'connectionString' => 'mysql:host=localhost;dbname=yclaozvj_brick',
			'emulatePrepare' => true,
			'username' => 'yclaozvj_test',
			'password' => 'JTE8Ztkd',
			'charset' => 'utf8',
		);
}
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'Rao vặt bất động sản',
   'timeZone' => 'Asia/Ho_Chi_Minh',
       // Other configuration....
	// preloading 'log' component
	'preload'=>array('log'),
   
	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
	),
   
	'modules'=>array(
		
      //Module cms for backend
      'admin',
      
      // uncomment the following to enable the Gii tool
		
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'chinhdaica',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		
	),

	// application components
	'components'=>array(
      /**
      'clientScript'=>array(
         'class' => 'CClientScript',
         'coreScriptPosition' => CClientScript::POS_END,
      ),
      */
      'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		// uncomment the following to enable URLs in path-format
		
		'urlManager'=>array(
			'urlFormat'=>'path',
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            '/dang-nhap'=>'/site/login',
            '/dang-ky'=>'/site/register',
            '/dang-tin'=>'/post/create',
            '/tin-tuc'=>'/news',
            '/du-an-da-trien-khai'=>'/news/project',
            '/phong-thuy'=>'/news/geomancy',
            '/tim-kiem'=>'/search',
            '/hoi-dap'=>'/question',
            '/gui-cau-hoi'=>'/question/create',
            '/lien-he'=>'/site/contact',
            '/gioi-thieu'=>'/introduction',
            '/cap-nhat-thong-tin-ca-nhan'=>'/member/edit',
            '/nha-dat-ban-<id:\d+>'=>'/category',
            '/nha-dat-cho-thue-<id:\d+>'=>'/category',
            '/rao-vat/<title:.*?>-<id:\d+>.html'=>'/post/detail',
            '/tin-tuc/<title:.*?>-<id:\d+>.html'=>'/news/detail',
            '/phong-thuy/<title:.*?>-<id:\d+>.html'=>'/news/detail',
            '/du-an/<title:.*?>-<id:\d+>.html'=>'/news/detail',
            '/hoi-dap/<title:.*?>-<id:\d+>.html'=>'/question/detail',
            //cms admin
            'admin/menu/edit/<id:\d+>'=>'admin/menu/edit',
            'admin/member/edit/<id:\d+>'=>'admin/member/edit',
            'admin/membergroup/edit/<id:\d+>'=>'admin/membergroup/edit',
            'admin/role/edit/<id:\d+>'=>'admin/role/edit',
            'admin/articles/edit/<id:\d+>'=>'admin/articles/edit',
            'admin/articles/<id:\d+>'=>'admin/articles/index',
            'admin/category/edit/<id:\d+>'=>'admin/category/edit',
            'admin/province/edit/<id:\d+>'=>'admin/province/edit',
            'admin/district/edit/<id:\d+>'=>'admin/district/edit',
            'admin/post/edit/<id:\d+>'=>'admin/post/edit',
            'admin/news/edit/<id:\d+>'=>'admin/news/edit',
            'admin/question/edit/<id:\d+>'=>'admin/question/edit',
            'admin/banner/edit/<id:\d+>'=>'admin/banner/edit',
			),
         'showScriptName'=>false,
		),
		
		'db'=>array(
			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
		),
		// uncomment the following to use a MySQL database
		
		'db'=>$info_db,
		
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
      'phpThumb' => array(
               'class'=>'application.extensions.EPhpThumb.EPhpThumb', 
            ),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
      'path_upload_image_post' => Yii::getPathOfAlias('webroot').'/uploads/pictures/post/',
      'path_image_post' => Yii::getPathOfAlias('webroot').'/uploads/pictures/post/',
      'path_image_news' => Yii::getPathOfAlias('webroot').'/uploads/pictures/news/',
      'path_image_banner' => Yii::getPathOfAlias('webroot').'/uploads/pictures/banners/',
      'default_image' => Yii::getPathOfAlias('webroot').'/uploads/pictures/post/default.jpg',
	),
);